import groovyx.net.ws.WSServer

class BookService {

  private List allBooks = new ArrayList()

  Book findBook(String isbn) {
    for (book in allBooks) {
      if (book.isbn == isbn) return book
    }
    return null
  }

  void addBook(Book book) {
    allBooks.add(book)
  }

  Book[] getBooks() {
    return (Book[])allBooks.toArray(new Book[allBooks.size()])
  }
  
  static void main(args) {
	  def server = new WSServer()

  	server.setNode("BookService", "http://localhost:6980/BookService")
  }
			
	
}